package com.xunk.equipment.service.mandun.enums;


import com.xunk.common.core.interfaces.EnumValidateInterface;

/**
 * @ProjectName: HIM
 * @Package: com.xunk.equipment.service.mandun.enums
 * @ClassName: MandunCmdEnum
 * @Author: luanzhiwei
 * @Description: 曼顿控制命令枚举
 * @Date: 2021/4/14 10:50
 * @Version: 1.0
 */
public enum MandunCmdEnum implements EnumValidateInterface {

    OPEN("open", "打开开关"),
    CLOSE("close", "关闭开关");

    private String code;
    private String desc;

    MandunCmdEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 判断是否是可用枚举
     *
     * @param code
     * @return
     */
    @Override
    public Boolean isValidEnum(String code) {
        for (MandunCmdEnum value : MandunCmdEnum.values()) {
            if (value.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }
}
